"use strict";
cc._RF.push(module, '0f869OVrIpB8KYCdqSGjtub', 'HallGiftView');
// scripts/HallGiftView.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GlobalUserData"),
    s = t("Global"),
    l = t("BaseStorage"),
    c = t("GiftPackage"),
    d = t("HallConstant"),
    h = t("Util"),
    p = cc._decorator,
    u = p.ccclass,
    f = p.property,
    m = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.pfb_gift = null, e.balloon = null, e.TTVideoIcon = null, e.velocity = 200, e.loopTime = function () {
      r["default"].nGuideStep < d.Guide_Step.trySuperCar ? this.balloon.active = !1 : this.getTime() <= 0 ? (l.BaseStorage.setInt("refreshGift", 0), this.balloon.active = !0, this.unschedule(this.loopTime)) : this.balloon.active = !1;
    }, e;
  }

  return n(e, t), e.prototype.start = function () {
    h.Util.is_tt() && !r["default"].bAuditMode && (this.TTVideoIcon.active = !0), this.balloon.x = -494, this.balloon.active = !1, this.loopTime(), this.schedule(this.loopTime, .5);
  }, e.prototype.onBtnGift = function () {
    this.balloon.active = !1;
    var t = cc.instantiate(this.pfb_gift),
        e = 1 == l.BaseStorage.getInt("refreshGift", 0);
    t.getComponent(c["default"]).initView(e, this.refresh.bind(this), this.cancelFunc.bind(this)), this.node.addChild(t), l.BaseStorage.setInt("refreshGift", 1);
  }, e.prototype.update = function (t) {
    this.balloon.x += this.velocity * t, this.balloon.x > 500 && (this.velocity = -200), this.balloon.x < -494 && (this.velocity = 200);
  }, e.prototype.refresh = function () {
    this.schedule(this.loopTime, .5), this.refreshGiftPackageStorageTime();
  }, e.prototype.cancelFunc = function () {
    this.schedule(this.loopTime, .5);
  }, e.prototype.getTime = function () {
    return l.BaseStorage.getInt(s.BaseStorageKey.GiftPackage, 0) - new Date().getTime();
  }, e.prototype.refreshGiftPackageStorageTime = function () {
    var t = 84600 - (3600 * new Date().getHours() + 60 * new Date().getMinutes() + new Date().getSeconds()),
        e = new Date().getTime() + 1e3 * t;
    l.BaseStorage.setInt(s.BaseStorageKey.GiftPackage, e);
  }, a([f(cc.Prefab)], e.prototype, "pfb_gift", void 0), a([f(cc.Node)], e.prototype, "balloon", void 0), a([f(cc.Node)], e.prototype, "TTVideoIcon", void 0), a([u], e);
}(cc.Component);

o["default"] = m;

cc._RF.pop();